package com.sais.manage.boot.platform.utils;

import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.crypto.hash.Sha256Hash;

/**
 * <p>
 * 加密工具类
 * </p>
 *
 * @author zwp
 * @since 2019/5/31
 */
@Slf4j
public class EncryptionUtils {

    public final static String SALT = "dormitory_manage";
    public final static int HASH_ITERATIONS = 3;

    private EncryptionUtils() {
    }

    public static String encryption(String string) {
        String s = new Sha256Hash(string, SALT, HASH_ITERATIONS).toString();
        return s;
    }

    public static String encryption(String string, String salt) {
        String s = new Sha256Hash(string, salt, HASH_ITERATIONS).toString();
        return s;
    }

    public static String encryption(String string, String salt, int hashIterations) {
        String s = new Sha256Hash(string, salt, hashIterations).toString();
        return s;
    }


}
